Optimal. Leaf size=40 \[ \frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \sin (x)}{\sqrt {a}}\right )}{\sqrt {a} (a+b)}+\frac {\tanh ^{-1}(\sin (x))}{a+b} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.03, antiderivative size = 40, normalized size of antiderivative = 1.00, number of steps
used = 4, number of rules used = 4, integrand size = 13, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.308, Rules used = {3269, 400, 212,
211} \begin {gather*} \frac {\sqrt {b} \text {ArcTan}\left (\frac {\sqrt {b} \sin (x)}{\sqrt {a}}\right )}{\sqrt {a} (a+b)}+\frac {\tanh ^{-1}(\sin (x))}{a+b} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 211
Rule 212
Rule 400
Rule 3269
Rubi steps
\begin {align*} \int \frac {\sec (x)}{a+b \sin ^2(x)} \, dx &=\text {Subst}\left (\int \frac {1}{\left (1-x^2\right ) \left (a+b x^2\right )} \, dx,x,\sin (x)\right )\\ &=\frac {\text {Subst}\left (\int \frac {1}{1-x^2} \, dx,x,\sin (x)\right )}{a+b}+\frac {b \text {Subst}\left (\int \frac {1}{a+b x^2} \, dx,x,\sin (x)\right )}{a+b}\\ &=\frac {\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \sin (x)}{\sqrt {a}}\right )}{\sqrt {a} (a+b)}+\frac {\tanh ^{-1}(\sin (x))}{a+b}\\ \end {align*}
________________________________________________________________________________________
Mathematica [B] Leaf count is larger than twice the leaf count of optimal. \(96\) vs. \(2(40)=80\).
time = 0.10, size = 96, normalized size = 2.40 \begin {gather*} \frac {-\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {a} \csc (x)}{\sqrt {b}}\right )+\sqrt {b} \tan ^{-1}\left (\frac {\sqrt {b} \sin (x)}{\sqrt {a}}\right )+2 \sqrt {a} \left (-\log \left (\cos \left (\frac {x}{2}\right )-\sin \left (\frac {x}{2}\right )\right )+\log \left (\cos \left (\frac {x}{2}\right )+\sin \left (\frac {x}{2}\right )\right )\right )}{2 \sqrt {a} (a+b)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.20, size = 55, normalized size = 1.38
method | result | size |
default | \(\frac {b \arctan \left (\frac {b \sin \left (x \right )}{\sqrt {a b}}\right )}{\left (a +b \right ) \sqrt {a b}}+\frac {\ln \left (1+\sin \left (x \right )\right )}{2 a +2 b}-\frac {\ln \left (\sin \left (x \right )-1\right )}{2 a +2 b}\) | \(55\) |
risch | \(-\frac {\ln \left ({\mathrm e}^{i x}-i\right )}{a +b}+\frac {\ln \left ({\mathrm e}^{i x}+i\right )}{a +b}+\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i x}+\frac {2 i \sqrt {-a b}\, {\mathrm e}^{i x}}{b}-1\right )}{2 a \left (a +b \right )}-\frac {\sqrt {-a b}\, \ln \left ({\mathrm e}^{2 i x}-\frac {2 i \sqrt {-a b}\, {\mathrm e}^{i x}}{b}-1\right )}{2 a \left (a +b \right )}\) | \(115\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.50, size = 47, normalized size = 1.18 \begin {gather*} \frac {b \arctan \left (\frac {b \sin \left (x\right )}{\sqrt {a b}}\right )}{\sqrt {a b} {\left (a + b\right )}} + \frac {\log \left (\sin \left (x\right ) + 1\right )}{2 \, {\left (a + b\right )}} - \frac {\log \left (\sin \left (x\right ) - 1\right )}{2 \, {\left (a + b\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.42, size = 116, normalized size = 2.90 \begin {gather*} \left [\frac {\sqrt {-\frac {b}{a}} \log \left (-\frac {b \cos \left (x\right )^{2} - 2 \, a \sqrt {-\frac {b}{a}} \sin \left (x\right ) + a - b}{b \cos \left (x\right )^{2} - a - b}\right ) + \log \left (\sin \left (x\right ) + 1\right ) - \log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a + b\right )}}, \frac {2 \, \sqrt {\frac {b}{a}} \arctan \left (\sqrt {\frac {b}{a}} \sin \left (x\right )\right ) + \log \left (\sin \left (x\right ) + 1\right ) - \log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a + b\right )}}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \frac {\sec {\left (x \right )}}{a + b \sin ^{2}{\left (x \right )}}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.45, size = 49, normalized size = 1.22 \begin {gather*} \frac {b \arctan \left (\frac {b \sin \left (x\right )}{\sqrt {a b}}\right )}{\sqrt {a b} {\left (a + b\right )}} + \frac {\log \left (\sin \left (x\right ) + 1\right )}{2 \, {\left (a + b\right )}} - \frac {\log \left (-\sin \left (x\right ) + 1\right )}{2 \, {\left (a + b\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 14.69, size = 856, normalized size = 21.40 \begin {gather*} -\frac {\mathrm {atan}\left (\frac {\frac {\left (4\,b^3\,\sin \left (x\right )+\frac {8\,a\,b^3+4\,b^4+4\,a^2\,b^2-\frac {\sin \left (x\right )\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{2\,\left (a+b\right )}}{2\,\left (a+b\right )}\right )\,1{}\mathrm {i}}{2\,\left (a+b\right )}+\frac {\left (4\,b^3\,\sin \left (x\right )-\frac {8\,a\,b^3+4\,b^4+4\,a^2\,b^2+\frac {\sin \left (x\right )\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{2\,\left (a+b\right )}}{2\,\left (a+b\right )}\right )\,1{}\mathrm {i}}{2\,\left (a+b\right )}}{\frac {4\,b^3\,\sin \left (x\right )+\frac {8\,a\,b^3+4\,b^4+4\,a^2\,b^2-\frac {\sin \left (x\right )\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{2\,\left (a+b\right )}}{2\,\left (a+b\right )}}{2\,\left (a+b\right )}-\frac {4\,b^3\,\sin \left (x\right )-\frac {8\,a\,b^3+4\,b^4+4\,a^2\,b^2+\frac {\sin \left (x\right )\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{2\,\left (a+b\right )}}{2\,\left (a+b\right )}}{2\,\left (a+b\right )}}\right )\,1{}\mathrm {i}}{a+b}-\frac {\mathrm {atan}\left (\frac {\frac {\left (2\,b^3\,\sin \left (x\right )+\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3+2\,b^4+2\,a^2\,b^2-\frac {\sin \left (x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{4\,\left (a^2+b\,a\right )}\right )}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {-a\,b}\,1{}\mathrm {i}}{a^2+b\,a}+\frac {\left (2\,b^3\,\sin \left (x\right )-\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3+2\,b^4+2\,a^2\,b^2+\frac {\sin \left (x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{4\,\left (a^2+b\,a\right )}\right )}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {-a\,b}\,1{}\mathrm {i}}{a^2+b\,a}}{\frac {\left (2\,b^3\,\sin \left (x\right )+\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3+2\,b^4+2\,a^2\,b^2-\frac {\sin \left (x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{4\,\left (a^2+b\,a\right )}\right )}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {-a\,b}}{a^2+b\,a}-\frac {\left (2\,b^3\,\sin \left (x\right )-\frac {\sqrt {-a\,b}\,\left (4\,a\,b^3+2\,b^4+2\,a^2\,b^2+\frac {\sin \left (x\right )\,\sqrt {-a\,b}\,\left (-8\,a^3\,b^2-8\,a^2\,b^3+8\,a\,b^4+8\,b^5\right )}{4\,\left (a^2+b\,a\right )}\right )}{2\,\left (a^2+b\,a\right )}\right )\,\sqrt {-a\,b}}{a^2+b\,a}}\right )\,\sqrt {-a\,b}\,1{}\mathrm {i}}{a\,\left (a+b\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________